#!perl -T

use strict;
use Test::More tests => 20;

BEGIN {
    use_ok('Nagios3::Plugin');
}

is(OK,        0, "OK");
is(WARNING,   1, "WARNING");
is(CRITICAL,  2, "CRITICAL");
is(UNKNOWN,   3, "UNKNOWN");
is(DEPENDENT, 4, "DEPENDENT");

my $nagios = Nagios3::Plugin->new();

is($nagios->id,     '',        "Empty Id");
is($nagios->status, 'UNKNOWN', "Initial status");

# Changing the ID
$nagios->id("Demo");
is($nagios->id, 'Demo', "Id");

# Creating with an Id
$nagios = Nagios3::Plugin->new('Test');
is($nagios->id, 'Test', "Id");

$nagios->status(OK);
is($nagios->status, 'OK', "Changing Status");
$nagios->status(WARNING);
is($nagios->status, 'WARNING', "Changing Status");
$nagios->status(CRITICAL);
is($nagios->status, 'CRITICAL', "Changing Status");
$nagios->status(UNKNOWN);
is($nagios->status, 'UNKNOWN', "Changing Status");
$nagios->status(DEPENDENT);
is($nagios->status, 'DEPENDENT', "Changing Status");

$nagios->status(OK);
$nagios->raise_status(WARNING);
is($nagios->status, 'WARNING', "Raising Status");
$nagios->raise_status(OK);
is($nagios->status, 'WARNING', "Raising Status");
$nagios->raise_status(CRITICAL);
is($nagios->status, 'CRITICAL', "Raising Status");
$nagios->raise_status(OK);
is($nagios->status, 'CRITICAL', "Raising Status");
$nagios->raise_status(WARNING);
is($nagios->status, 'CRITICAL', "Raising Status");

